package com.social.socialservice.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {

    /***
     * 自定义资源映射
     * 上传静态文件
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/img/**")
                .addResourceLocations("file:src/main/resources/static/img/");
        registry.addResourceHandler("/video/**")
                .addResourceLocations("file:src/main/resources/static/video/");
        registry.addResourceHandler("/person/header/**")
                .addResourceLocations("file:src/main/resources/static/person/header/");
        registry.addResourceHandler("/person/bg/**")
                .addResourceLocations("file:src/main/resources/static/person/bg/");
    }
}